<template>
	<view style="padding: 30rpx;">
		<view class="flex baseitem" @click="$goTo('/pages/article/article?title=用户协议&type=servicecontent')">
			<text>用户协议</text>
			<u-icon name='arrow-right'></u-icon>
		</view>
		<view class="flex baseitem" @click="$goTo('/pages/article/article?title=隐私政策&type=privacycontent')">
			<text>隐私政策</text>
			<u-icon name='arrow-right'></u-icon>
		</view>
		<view class="flex baseitem" @click="$goTo('/pages/article/article?title=关于我们&type=aboutcontent')">
			<text>关于我们</text>
			<u-icon name='arrow-right'></u-icon>
		</view>
		<view class="flex baseitem" @click="cold">
			<text>注销账号</text>
			<u-icon name='arrow-right'></u-icon>
		</view>
		<view class="logout" @click="logout">
			退出当前账号
		</view>
		<view class="company">
			<view class="t">{{config.firm_name}} 版权所有</view>
			<view class="b">Copyright © {{config.ban}} All Rights Reserved</view>
		</view>
	</view>
</template>

<script>
	import {
		setTimeout
	} from 'timers';
	export default {
		data() {
			return {
				config: this.$store.state.config
			};
		},
		mounted() {
		},
		methods: {
			cold() {
				uni.showModal({
					title: '温馨提示',
					content: '确定注销该账号吗？',
					success: (res) => {
						if (res.confirm) {
							this.$api.post('/cold').then(res => {
								if (res.code == 1) {
									this.$toast('已注销')
									uni.removeStorageSync('token')
									setTimeout(() => {
										uni.reLaunch({
											url: '/pages/index/index',
										})
									}, 1000)
								}
							})
						} else if (res.cancel) {
							
						}
					}
				});
			},
			logout() {
				var that = this
				uni.showModal({
					content: '确定退出登录吗？',
					success(res) {
						if (res.confirm) {
							uni.removeStorageSync('token')
							setTimeout(() => {
								uni.reLaunch({
									url: '/pages/index/index',
								})
							}, 1000)
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.baseitem {
		margin-top: 30rpx;
		background-color: #fff;
		border-radius: 30rpx;
		box-sizing: border-box;
		padding: 30rpx;
		align-items: center;
		justify-content: space-between;
	}

	.logout {
		margin-top: 30rpx;
		background-color: #fff;
		border-radius: 30rpx;
		box-sizing: border-box;
		padding: 30rpx;
		text-align: center;
		color: #D21B1B;
	}

	.company {
		position: absolute;
		left: 0;
		bottom: 100rpx;
		width: 100%;

		.t {
			font-size: 28rpx;
			color: #999;
			text-align: center;
			margin-bottom: 20rpx;
		}

		.b {
			font-size: 28rpx;
			color: #999;
			text-align: center;
		}
	}
</style>